﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SpWiki.Lib
{
    using System.Globalization;

    /// <summary>
    /// Utilities
    /// </summary>
    public static class Utils
    {
        /// <summary>
        /// Decodes a hex string.
        /// </summary>
        /// <param name="hexString">The hex string.</param>
        /// <returns></returns>
        public static string DecodeHexString(string hexString)
        {
            var sb = new StringBuilder();
            for (var i = 0; i <= hexString.Length - 2; i += 2)
            {
                sb.Append(
                    Convert.ToString(
                        Convert.ToChar(Int32.Parse(hexString.Substring(i, 2), NumberStyles.HexNumber))));
            }
            return sb.ToString();
        }
    }
}
